package com.woniu.day8.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniu.day8.pojo.Parking;
import com.woniu.day8.pojo.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface ParkingMapper extends BaseMapper<Parking> {
    @Select("SELECT * FROM t_parking ${ew.customSqlSegment}")
    @Results(value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(property = "numbers", column = "numbers"),
            @Result(property = "status", column = "status"),
            @Result(property = "desc", column = "desc"),
            @Result(property = "owner", column = "owner_id",
            many = @Many(select = "com.woniu.day8.mapper.OwnerMapper.selectOwnerById")),
    })

    List<Parking> selectParking(IPage<UserInfo> page, @Param("ew") QueryWrapper<UserInfo> wrapper);
}
